package main.od;

import java.util.Scanner;

public class WolfGoatFarmerTest {
    public static Integer minTimes = Integer.MAX_VALUE;

    public static void dfs(int m,int n,int x,int m1,int n1,int times){
        if (m < 0 || n < 0){
            return;
        }
        if ((m < n && m != 0) || (m1 < n1 && m1 != 0)){
            return;
        }
        if (m == 0 && n == 0){
            minTimes = Math.min(times,minTimes);
            return;
        }
        for (int i = 1;i <= x;i++){
            for (int j = 0;j <= x - i;j++){
                dfs(m - i,n - j,x,m1 + i,n1 + j,times + 1);
            }
        }

    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int m = 0,n = 0,x = 0;
        m = in.nextInt();
        n = in.nextInt();
        x = in.nextInt();
        if (m < n){
            System.out.println("0");
        }
        dfs(m,n,x,0,0,0);
        System.out.println(minTimes == Integer.MAX_VALUE ? 0 : minTimes);
    }
}
